package com.project.xsf.service.impl;

import com.project.junM.entity.TMember;
import com.project.xsf.entity.TAssess;
import com.project.xsf.mapper.TAssessMapper;
import com.project.xsf.service.TAssessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpSession;

@Transactional
@Service
public class TAssessImpl implements TAssessService {
    @Autowired
    private TAssessMapper tAssessMapper;

    @Override
    public int insertSelective(TAssess record) {
        return tAssessMapper.insertSelective(record);
    }

    @Override
    public Boolean queryTAssessByUserId(HttpSession session) {
        TMember member = (TMember) session.getAttribute("user");
//        System.out.println(member);
        TAssess tAssess = tAssessMapper.selectTMember(member.getId());
        if(tAssess==null||tAssess.getEvaluateId()!=null){
            return false;
        }else {
            return true;
        }
    }
}
